package ProjectTeam39.GUITest;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class ErrorFrame extends JFrame{
	ErrorFrame eframe = this;
	JFrame frame;
	public ErrorFrame(final JFrame frame, String message) {
		this.frame = frame;
		JLabel label = new JLabel(message);
		label.setHorizontalAlignment(SwingConstants.CENTER);
		getContentPane().add(label, BorderLayout.CENTER);
		
		JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.SOUTH);
		
		JButton btnBack = new JButton("Back");
		btnBack.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				eframe.setVisible(false);
				frame.setVisible(true);
			}
		});
		panel.add(btnBack);
	}

}
